package com.zheng.study.web.controller.main;

import com.zheng.study.base.bean.BaseEnumManager;
import com.zheng.study.base.utils.HttpRequestUtil;
import com.zheng.study.company.entity.Admin;
import com.zheng.study.company.entity.User;
import com.zheng.study.web.controller.BaseController;
import com.zheng.study.web.shiro.bind.annotation.CurrentUser;
import eu.bitwalker.useragentutils.UserAgent;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * newFile
 * ============================================================================
 * author : dzw
 * createDate:  2018/8/21 。
 * ============================================================================
 */
@Controller
@RequestMapping(value = "/main")
public class IndexController extends BaseController {
	private static final long serialVersionUID = 1916191424013611095L;

	/**
	 * 跳转到首页
	 */
	@RequestMapping(value = "index", method = RequestMethod.GET)
	public String index(@CurrentUser User user, Model model){
		model.addAttribute("user", user);
		model.addAttribute("account", adminService.getAccount(user));
		model.addAttribute("userHeadUrl", userService.getUserHeadUrl(user));
		adminService.updateLoginInfo(adminService.get(user.getAdminId()), request);
		return "/main/index";
	}

}
